<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('角色列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="select-list">
                    <ul>
                        <li>
                            分组名称：<input type="text" name="groupName"/>
                        </li>
                        <li>
                            用户名称：<input type="text" name="createName"/>
                        </li>

                        <li class="select-time">
                            <label>创建时间： </label>
                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]" />
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]" />
                        </li>

                        <li class="select-Num">
                            <label style="width: 100px" >包含大屏数量： </label>
                            <input type="text" style="width: 80px"  placeholder="起始数量" name="params[beginNum]" />
                            <span>-</span>
                            <input type="text" style="width: 80px"  placeholder="结束数量" name="params[endNum]" />
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

            <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:UserBaseGroup:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:UserBaseGroup:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:UserBaseGroup:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:UserBaseGroup:remove')}]];
    var datas = [[${@dict.getType('online_status')}]];
    var prefix = ctx + "system/UserBaseGroup";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            //sortName: "roleSort",
            modalName: "大屏分组",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'groupName',
                    title: '大屏分组名称'
                },
                {
                    field: 'baseCount',
                    title: '分组所含大屏数量'
                },
                {
                    field: 'createName',
                    title: '所属用户',
                    sortable: true
                },
                {
                    field: 'createTime',
                    title: '创建时间',
                    sortable: true
                },
                {
                    field: 'updateTime',
                    title: '更新时间',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="showUserVisualBase(\'' + row.id + '\',\'' + row.groupName + '\')"><i class="fa fa-edit"></i>查看包含大屏</a> ');
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="updateNameById(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改分组名称</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function updateNameById(id) {
        $.modal.open("修改分组名", prefix + "/edit/" + id,800,250);
    }

    function showUserVisualBase(id,name) {
        $.modal.openTab(name + "所含大屏", ctx + "system/UserVisualBase/" + id);
    }


</script>
</body>
</html>